package com.g.localmsg.starter.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

@ConfigurationProperties(prefix = "ldtx")
@Data
public class DistributedTransactionProperties {
    // 是否开启分布式事务
    private boolean enabled = true;

    private RetryConfig retry = new RetryConfig();

    private ThreadPoolProperties threadPool = new ThreadPoolProperties();

    @Data
    public static class RetryConfig{
        //是否启用重试，分布式环境中需要注意分片问题，或者单机执行任务
        private boolean enableRetry = true;

        //扫描间隔
        private long   scanInterval = 60;

        //批量处理大小
        private int batchSize = 100;
    }
    @Data
    public static class ThreadPoolProperties {
        private int corePoolSize = 10;
        private int maxPoolSize = 20;
        private int queueCapacity = 100;
        private int keepAliveSeconds = 60;
        private String threadNamePrefix = "ldtx-pool-";
    }
}
